home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / mfc mdiplayer.win / mfcmdiplayerdoc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-28  |  2.3 KB  |  103 lines

  1. // MFCMDIPlayerDoc.cpp : implementation of the CMFCMDIPlayerDoc class
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "MFCMDIPlayer.h"
  6.  
  7. #include "MFCMDIPlayerDoc.h"
  8. #include "MFCMDIPlayerView.h"
  9.  
  10. #ifdef _DEBUG
  11. #define new DEBUG_NEW
  12. #undef THIS_FILE
  13. static char THIS_FILE[] = __FILE__;
  14. #endif
  15.  
  16. /////////////////////////////////////////////////////////////////////////////
  17. // CMFCMDIPlayerDoc
  18.  
  19. IMPLEMENT_DYNCREATE(CMFCMDIPlayerDoc, CDocument)
  20.  
  21. BEGIN_MESSAGE_MAP(CMFCMDIPlayerDoc, CDocument)
  22.     //{{AFX_MSG_MAP(CMFCMDIPlayerDoc)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CMFCMDIPlayerDoc construction/destruction
  30.  
  31. CMFCMDIPlayerDoc::CMFCMDIPlayerDoc()
  32. {
  33.     // TODO: add one-time construction code here
  34.  
  35. }
  36.  
  37. CMFCMDIPlayerDoc::~CMFCMDIPlayerDoc()
  38. {
  39. }
  40.  
  41. BOOL CMFCMDIPlayerDoc::OnNewDocument()
  42. {
  43.     if (!CDocument::OnNewDocument())
  44.         return FALSE;
  45.  
  46.     // TODO: add reinitialization code here
  47.     // (SDI documents will reuse this document)
  48.  
  49.     return TRUE;
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMFCMDIPlayerDoc serialization
  54.  
  55. void CMFCMDIPlayerDoc::Serialize(CArchive& ar)
  56. {
  57.     if (ar.IsStoring())
  58.     {
  59.         // TODO: add storing code here
  60.     }
  61.     else
  62.     {
  63.         // TODO: add loading code here
  64.     }
  65. }
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CMFCMDIPlayerDoc diagnostics
  69.  
  70. #ifdef _DEBUG
  71. void CMFCMDIPlayerDoc::AssertValid() const
  72. {
  73.     CDocument::AssertValid();
  74. }
  75.  
  76. void CMFCMDIPlayerDoc::Dump(CDumpContext& dc) const
  77. {
  78.     CDocument::Dump(dc);
  79. }
  80. #endif //_DEBUG
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83. // CMFCMDIPlayerDoc commands
  84.  
  85. BOOL CMFCMDIPlayerDoc::OnOpenDocument(LPCTSTR lpszPathName) 
  86. {
  87.     if (!CDocument::OnOpenDocument(lpszPathName))
  88.         return FALSE;
  89.     
  90.     
  91.     // Set the Movie filename for the view
  92.     POSITION pos = GetFirstViewPosition();
  93.     CMFCMDIPlayerView* pView = (CMFCMDIPlayerView*)GetNextView(pos);
  94.     if (pView){
  95.         pView->mfullPath = lpszPathName;
  96.         if (pView->OpenMovie() != TRUE)
  97.             return FALSE;
  98.     }
  99.     return TRUE;
  100.     
  101.     return TRUE;
  102. }
  103.